package com.ag.wzp.bak;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.ag.bean.TbPropose;
import com.ag.bean.TbSched;
import com.ag.bean.TbUser;
import com.ag.common.IDUtil;
import com.ag.common.IIDService;
import com.ag.dao.TbProposeDAO;
import com.ag.wsq.service.impl.OneSchedServiceImpl;

@Service("proposeServiceImpl")
public class ProposeServiceImpl {
	private static final long serialVersionUID = 1L;
	private static final Logger logger = Logger.getLogger(ProposeServiceImpl.class);
	@Resource(name = "iDServiceImpl")
	private IIDService idServiceImpl;
	@Resource(name = "oneSchedServiceImpl")
	private OneSchedServiceImpl oneSchedServiceImpl;
	@Resource(name = "TbProposeDAO")
	TbProposeDAO proposeDAO;
	
	public boolean save(TbPropose propose){
		propose.setPpId(idServiceImpl.findTablePK(IDUtil.TB_PROPOSE));
		propose.setPaTime(new Date());
		propose.setA(IDUtil.PRESERVE);
		List<TbSched> scheds = this.oneSchedServiceImpl.oneSched();
		logger.info(scheds.get(0).getTbUser().getUId());
		logger.info(scheds.size());
		if(scheds.size()>0){
			logger.info(scheds.get(0).getTbUser());
			//propose.setTbUserByTbUId(scheds.get(0).getTbUser());
		}
		this.proposeDAO.save(propose);
		return false;
	}
}
